<?php
class Subscriber_model extends Model
{
    function __construct()
    {
        parent::__Construct();
        
    }
    
    function getAllResults()
    {
        $this->load->database();
        $query = $this->db->get('bur_subscribers');
        
        return $query->result();
    }
    
    function delete_subscriber($id)
    {
        $this->db->delete('bur_subscribers',array('subscriber_id'=>$id));
        $debug = $this->db->last_query();
        return $debug;
        
    }
    
    function exporttoexcel()
    {
        $this->load->database();
        
        $this->load->helper('date');
        
        $query = $this->db->get('bur_subscribers');
         
        $this->load->helper('csv');
        //echo query_to_csv($query);
        $now = time();
        query_to_csv($query, TRUE, 'subscriber_'.unix_to_human($now).'.csv');
    }
    
}
?>